from django.urls import path
from rest_framework.routers import DefaultRouter
from rest_framework_swagger.views import get_swagger_view

from api.views import show_teachers, praise_or_criticize, get_stat_data, SubjectViewSet

# 获取生成接口文档的视图函数
schema_view = get_swagger_view(title='项目接口文档')

urlpatterns = [
    path('docs/', schema_view),
    path('teachers/', show_teachers),
    path('praise/', praise_or_criticize),
    path('criticize/', praise_or_criticize),
    path('data/', get_stat_data),
    # 通过视图类的as_view()类方法获得对应的函数
    # path('hotsubs/', HotSubjectView.as_view()),
]

router = DefaultRouter()
router.register('subjects', SubjectViewSet)
urlpatterns += router.urls
